﻿using Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;

namespace DAL
{
    public class D_TeaChoice
    {
        public bool saveResult(List<TeaChoice> tc)// 对应D_T.cs 的save_list(List<t_data>)
        {
            var count = SqlSugarHelper.Db.Storageable<TeaChoice>(tc).ExecuteCommand();
            return count == tc.Count ? true : false;
        }

        public TeaChoice select(Teacher teacher) // 对应D_T.cs 的select(Teacher)
        {
            var t = SqlSugarHelper.Db.Queryable<TeaChoice>().Where(m_t => m_t.Teacher_id == teacher.teacher_id).ToList();
            if (t.Count == 0) { return null; }

            return t[0];
        }

        public int commit(TeaChoice model)//对应D_T.cs 的commit_sugar(t_data)
        {
            var count = SqlSugarHelper.Db.Storageable(model).ExecuteCommand();
            return count;
        }

        public List<TeaChoice> getList()//对应D_T.cs 的getList()
        {
            var list = SqlSugarHelper.Db.Queryable<TeaChoice>().ToList();
            return list;
        }
    }
}
